package com.aotain.nyx.flowstatd;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.tuple.Tuple2;

import com.aotain.nyx.statis.AbnStatisTuple;

public class FlowAttStatMap implements MapFunction<AbnStatisTuple, Tuple2<String,AbnStatisTuple>> {

	/** 
	* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么) 
	*/ 
	private static final long serialVersionUID = -2716766572348662924L;

	@Override
	public Tuple2<String, AbnStatisTuple> map(AbnStatisTuple value)
			throws Exception {
		// TODO Auto-generated method stub
		Tuple2<String,AbnStatisTuple> ret = new Tuple2<String,AbnStatisTuple>();
		String attType = value.getAttackType();
		if("1".equals(attType)) {
			String key = value.getDestIP() + "_" + value.getSourceIP() + "_" + value.getType();
			ret.setFields(key, value);
		}
		return ret;
	}

}
